
public class Phone {
	
	public String number;
	
	public Phone(String s){
		number = s.trim();
	}
	
	/*public String getFormatted(){
		//Format1: +79261234567
		if (isFormat1()) return ("+7("+number.substring(2, 5)+")"+number.substring(6);
		
	}*/
	
	public long getNumeric(){
		number = number.replace(" ", "");
		number = number.replace("-", "");
		number = number.replace("(", "");
		number = number.replace(")", "");
		if (number.startsWith("+7")) number = number.replace("+7", "");
		if (number.startsWith("8")) number = number.replaceFirst("8", "");
		if (number.length()<=7) number="495"+number;
		return new Long(number);
	}
	
	public String getFormatted(){
		return "+7"+"("+number.substring(0, 3)+")"+number.substring(3);
	}
}
